GBML manual / Rooms

room_forget_all

Makes the game forget every room it was keeping, so each one is built new from what you placed in it the next time the player goes there.

Syntax

room_forget_all()

Returns

Nothing.

Description

Makes the game forget every room it was keeping, so each of them is built new, from what you placed in it, the next time the player goes there. A room marked Persistent is kept when you leave it (see Persistent rooms); this is how a game that starts over without being switched off puts all of them back to the beginning.

Use it for a new game, or when the player loads a different save. save_clear already does it for you. It is also the right thing to call when the player picks "start again" from a menu and your code does not call save_clear.

The objects of every forgotten room get their Cleanup event and are gone for good. The room the player is in is not touched, because it is not being kept: it is the live one. Use room_restart to build it again.

A game with no Persistent room never keeps anything, so calling this there does nothing at all. It works at once, in the middle of whatever event called it.

Example

if (btn_pressed(BTN_SELECT)) {
    room_forget_all();
}

Pressing SELECT makes the game forget every room it was keeping. The room the player is standing in stays as it is.

On the GBA

Use it when the game starts over without being switched off: a new game, or loading a different save. save_clear calls it for you. The objects of every forgotten room get their Cleanup event and are gone for good. Rooms that are not Persistent are never kept, so a game without any Persistent room can call this and nothing happens. It happens at once, in the middle of whatever event called it.

See also: room_forgetroom_restartsave_clear